package com.whmnx.home.ui.adapter;

import android.content.Context;
import android.text.TextUtils;

import com.classic.adapter.BaseAdapterHelper;
import com.classic.adapter.CommonRecyclerAdapter;
import com.whmnx.base.bean.OrderBean;
import com.whmnx.base.utils.ImageUtil;
import com.whmnx.base.view.RoundImageView;
import com.whmnx.home.R;

/**
 * author : huang
 * date   : 2020/10/19 0019 9:17
 * version: 1.0
 * @author Administrator
 */
public class OrderListAdapter2 extends CommonRecyclerAdapter<OrderBean.ShopModelBean.ProductListBean> {
    Context context;

    public OrderListAdapter2(Context context) {
        super(context, R.layout.item_order2);
        this.context = context;
    }


    @Override
    public void onUpdate(BaseAdapterHelper helper, OrderBean.ShopModelBean.ProductListBean item, int position) {
            helper.setText(R.id.tv_Product_Name, (String) item.getProduct_Name());
            helper.setText(R.id.tv_Product_SPEC, (String) item.getProduct_SPEC());
            helper.setText(R.id.tv_Product_Price, "￥" + item.getProduct_Price());
            helper.setText(R.id.tv_Product_Num, "X" + item.getProduct_Num());

            if (!TextUtils.isEmpty(item.getProduct_Image())) {
                String[] split = item.getProduct_Image().split(",");
                String url = split[0];
                ImageUtil.setImage((RoundImageView) helper.getView(R.id.iv_img), url);
            }
        }

}
